
import React, { useEffect, useMemo } from 'react';
// import { PixijsRender, PixijsView } from '../lib';
import {PixijsRender, PixijsView} from '../'

const data = {"version":"0.0.1","entitys":[{"className":"GroupEntity","id":11,"position":{"x":-13660.595119622592,"y":-5966.901360029079},"anchor":{"x":0.5,"y":0.5},"rotation":0,"name":"group","children":[7,8],"scale":{"x":1,"y":1},"skew":{"x":0,"y":0},"selected":true,"visible":true,"expanded":true,"viewState":2,"flags":4294967295,"allowChildSelection":false},{"className":"SpriteEntity","id":7,"position":{"x":-103.82994454713503,"y":-309.0573012939001},"anchor":{"x":0.5,"y":0.5},"rotation":0,"name":"CCWE1400H","children":[],"scale":{"x":1,"y":1},"skew":{"x":0,"y":0},"selected":false,"visible":true,"url":"2d/主设备/CCWE1400H.png","viewState":2,"flags":4294967295},{"className":"SpriteEntity","id":8,"position":{"x":119.82994454713503,"y":309.0573012939012},"anchor":{"x":0.5,"y":0.5},"rotation":0,"name":"CCWE1800H","children":[],"scale":{"x":1,"y":1},"skew":{"x":0,"y":0},"selected":false,"visible":true,"url":"2d/主设备/CCWE1800H.png","viewState":2,"flags":4294967295}]}
export const App: React.FC = () => {
    const render = useMemo(() => {
        return new PixijsRender();
    }, [])

    useEffect(() => {
        render.world.clear();
        if(data) render.world.addBlockFromJson(data);
    }, []);


    return <PixijsView render={render} />
};
